package com.ctl.szmd.szmd.feature_wm.ui.adapter.footer

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.paging.LoadState
import com.ctl.lib_common.widget.MyLoadStateAdapter
import com.ctl.szmd.szmd.feature_wm.R


class FooterAdapter(private val retryCallback: () -> Unit) :
    MyLoadStateAdapter<NetworkStateItemViewHolder>() {
    override fun onBindViewHolder(holder: NetworkStateItemViewHolder, loadState: LoadState) {
        holder.bindData(loadState, 0)
    }

    override fun onCreateViewHolder(
        parent: ViewGroup,
        loadState: LoadState
    ): NetworkStateItemViewHolder {
        val view = LayoutInflater.from(parent.context)
            .inflate(R.layout.recycie_item_network_state, parent, false)
        return NetworkStateItemViewHolder(view) {
            retryCallback()
        }
    }

}